import logst.parsers_base as parsers_base

class sysrqt_Parser(parsers_base.base_Parser_class):

   default_icon = "images/32px-Crystal_Clear_app_ksysguard.png"

   def init_activators(self):

      self.add_regex_activator("""SysRq : Show State""", self.parse)

   def parse(self, log):

      # Found an SysRq+t dump!
      self.add_event(log, "SysRq+T (Task State Dump)")

      return

# - listare process nello stack trace
# - filtrare processi
# - confrontare piu' sysrq

# leo: 1: ^# kernel: [^ ][^:]*$
# leo: 2: ^# kernel:        [0-9a-fA-F].*$
# leo: 3: ^# kernel:  \[.*$

# kernel: SysRq : Show State
# kernel:   task                PC stack   pid father
# kernel: init          D c20fcb30  2104     1      0
# kernel:        c20fcb44 00000082 00000002 c20fcb30 c20fcb28 00000000 c20fc000 113e5601 
# kernel:        0000f0fd f7d82000 f7d8219c c2009a80 00000001 f783e380 c081de80 ffff007b 
# kernel:        00000286 c042ff1b c20fcb54 00009b73 00000000 00000286 c043002f 00000000 
# kernel: Call Trace:
# kernel:  [<c042ff1b>] lock_timer_base+0x19/0x35
# kernel:  [<c043002f>] __mod_timer+0x9a/0xa4
# kernel:  [<c062f3d9>] schedule_timeout+0x70/0x8f
# kernel:  [<c047f331>] pipe_poll+0x0/0x71
# [...]
# kernel:  =======================
# kernel: kthreadd      S c20f1fbc  3488     2      0
# kernel:        c20f1fd0 00000046 00000002 c20f1fbc c20f1fb4 00000000 c20f1000 00000001 
# kernel:        00000082 f7d82600 f7d8279c c2009a80 00000001 f2fdde00 00000000 00000003 
# kernel:        c94aec84 00000001 1b49e147 c94aec84 00000292 ffffffff 00000000 00000000 
# kernel: Call Trace:
# kernel:  [<c0438252>] kthreadd+0x5f/0xf5
# kernel:  [<c04381f3>] kthreadd+0x0/0xf5
# kernel:  [<c0405b6b>] kernel_thread_helper+0x7/0x10

# kernel:   task                 PC          pid father child younger older
# kernel: kernel: pdflush       S ffffffff8014ba68     0   101     18           103   100 (L-TLB)
